﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace AFCEPF.Samples.WebSamples
{
    /// <summary>
    /// Convenience class used to get Binding sources.
    /// </summary>
    public static class BindingProvider
    {
        private static List<string> _listOfStrings;
        private static Dictionary<int, string> _listOfKeyedStrings;
        private static DataSet _ds;
        
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static List<string> GetListOfStrings()
        {
            if (_listOfStrings == null)
            {
                _listOfStrings = new List<string> {"Asp.net", "PHP", "Drupal", "Joomla", "Ruby on Rails"};
            }
            return _listOfStrings;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static Dictionary<int, string> GetListOfKeyedStrings()
        {
            if (_listOfKeyedStrings == null)
            {
                _listOfKeyedStrings = new Dictionary<int, string>
                                          {
                                              {1, "Asp.Net"},
                                              {2, "PHP"},
                                              {3, "Drupal"},
                                              {4, "Joomla"},
                                              {5, "Ruby On Rails"}
                                          };
            }
            return _listOfKeyedStrings;
        }
        
        
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static DataSet GetDataSet_Countries()
        {
            _ds = new DataSet();
            _ds.ReadXml(HttpContext.Current.Server.MapPath("/Files/countries.xml"));
            return _ds;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static DataSet GetDataSet_CdCatalog()
        {
            _ds = new DataSet();
            _ds.ReadXml(HttpContext.Current.Server.MapPath("/Files/cdcatalog.xml"));
            return _ds;
        }

    }
}